package com.ssyt.yt1.day5.encapsulation;

/**
 * 编程原则：<br/>
 * 1、类的所有属性尽量都封装（除了静态常量） <br/>
 * 2、一般来说一个类都会附属setter&getter，构造方法也是一种设值方式（可选）
 * 
 * @author Administrator
 *
 */
public class Computer {

	// 属性
	private String brand;
	private double price;
	private String color;
	private String size;
	// 单位：千克
	private double weight;
	private String cpuVersion;
	private String cpuLevel;

	// 构造方法
	/**
	 * 在我们没定义构造方法的时候，系统会默认的生成一个无参什么都不做的构造方法
	 */
	public Computer() {

	}

	/**
	 * 但当我们自己写了一些有参构造方法后，就会把默认的构造方法给覆盖掉，此时如果仍然还需要默认的构造方法，需要我们显示的声明出来！
	 * 
	 * @param brand
	 * @param price
	 */
	public Computer(String brand, double price) {
		super();
		this.brand = brand;
		this.price = price;
	}

	// 方法
	public String getBrand() {
		return brand;
	}

	public void setBrand(String brand) {
		this.brand = brand;
	}

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(double weight) {
		this.weight = weight;
	}

	public String getCpuVersion() {
		return cpuVersion;
	}

	public void setCpuVersion(String cpuVersion) {
		this.cpuVersion = cpuVersion;
	}

	public String getCpuLevel() {
		return cpuLevel;
	}

	public void setCpuLevel(String cpuLevel) {
		this.cpuLevel = cpuLevel;
	}

	public String showInfo() {
		return "Computer [brand=" + brand + ", price=" + price + ", color="
				+ color + ", size=" + size + ", weight=" + weight
				+ ", cpuVersion=" + cpuVersion + ", cpuLevel=" + cpuLevel + "]";
	}

}
